package co.com.avaid.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public abstract class ConnectionDataBase {
	
	/**
	 * Constantes
	 */
	private static final String DB_DRIVER = "com.mysql.jdbc.Driver";
	private static final String DB_HOST = "jdbc:mysql://avaid.com.co/";
	private static final String DB_NAME = "avaidcom_bdapp";
	private static final String DB_USER = "avaidcom_android";
	private static final String DB_PASSWORD = "d&[0=f%dbn#c";
	
	/**
	 * Variables
	 */
	private static Connection connection;

	/**
	 * Metodos
	 */

	protected static Connection connect(){		
		try {
			Class.forName(DB_DRIVER);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}		
		try {
			connection = DriverManager.getConnection(DB_HOST + DB_NAME, DB_USER, DB_PASSWORD);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		return connection;
	}
	
	protected static void disconnect(Connection connection){		
		try {
			connection.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}